==22361==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c015880010 at pc 0x7ffff6e1c028 bp 0x7fffe95eb930 sp 0x7fffe95eb928
READ of size 8 at 0x60c015880010 thread T6
    #0 0x7ffff6e1c027 in PyContextVar_Get /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/context.c:229:5
    #1 0x7fffe6cf8583 in current_context /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Modules/_decimal/_decimal.c:1517:9
    #2 0x7fffe6cf8583 in dec_new /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Modules/_decimal/_decimal.c:2652
    #3 0x7ffff6c49527 in type_call /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/typeobject.c:929:11
    #4 0x7ffff6b35454 in _PyObject_FastCallKeywords /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/call.c:199:18
    #5 0x7ffff6d7c85c in call_function /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/ceval.c:4619:17
    #6 0x7ffff6d677c1 in _PyEval_EvalFrameDefault /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/ceval.c:3093:23
    #7 0x7ffff6b34b99 in PyEval_EvalFrameEx /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/ceval.c:547:12
    #8 0x7ffff6b34b99 in function_code_fastcall /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/call.c:283
    #9 0x7ffff6d7cf31 in call_function /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/ceval.c:4616:17
    #10 0x7ffff6d6779a in _PyEval_EvalFrameDefault /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/ceval.c:3110:23
    #11 0x7ffff6b34b99 in PyEval_EvalFrameEx /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/ceval.c:547:12
    #12 0x7ffff6b34b99 in function_code_fastcall /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/call.c:283
    #13 0x7ffff6b338d4 in _PyFunction_FastCallDict /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/call.c
    #14 0x4050d6 in ThreadFunc() /home/local/TENSOR-CORP/boytsovea/python_crash/main.cpp:22:28
    #15 0x4077db in void std::__invoke_impl<void, void (*)()>(std::__invoke_other, void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/invoke.h:60:14
    #16 0x40774c in std::__invoke_result<void (*)()>::type std::__invoke<void (*)()>(void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/invoke.h:95:14
    #17 0x407724 in void std::thread::_Invoker<std::tuple<void (*)()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/thread:244:13
    #18 0x4076f4 in std::thread::_Invoker<std::tuple<void (*)()> >::operator()() /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/thread:251:11
    #19 0x407598 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> > >::_M_run() /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/thread:195:13
    #20 0x7ffff62bf0df  (libstdc++.so.6+0xd00df)
    #21 0x7ffff65d9dd4 in start_thread /usr/src/debug/glibc-2.17-c758a686/nptl/pthread_create.c:307
    #22 0x7ffff5a05eac in __clone /usr/src/debug////////glibc-2.17-c758a686/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:111

0x60c015880010 is located 16 bytes inside of 128-byte region [0x60c015880000,0x60c015880080)
freed by thread T3 here:
    #0 0x7ffff7268477 in __interceptor_free (/opt/pytsandebug3.7/lib64/libclang_rt.asan-x86_64.so+0x125477)
    #1 0x7ffff6e2084a in hamt_node_bitmap_dealloc /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/hamt.c:1182:13
    #2 0x7ffff6e20dbe in hamt_tp_clear /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/hamt.c:2718:5
    #3 0x7ffff6e20dbe in hamt_tp_dealloc /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/hamt.c:2737
    #4 0x7ffff6e1eba2 in context_tp_clear /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/context.c:425:5
    #5 0x7ffff6e1eba2 in context_tp_dealloc /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/context.c:445
    #6 0x7ffff6e19627 in PyGILState_Release /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/pystate.c:1112:9
    #7 0x405281 in ThreadFunc() /home/local/TENSOR-CORP/boytsovea/python_crash/main.cpp:33:7
    #8 0x4077db in void std::__invoke_impl<void, void (*)()>(std::__invoke_other, void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/invoke.h:60:14
    #9 0x40774c in std::__invoke_result<void (*)()>::type std::__invoke<void (*)()>(void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/invoke.h:95:14
    #10 0x407724 in void std::thread::_Invoker<std::tuple<void (*)()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/thread:244:13
    #11 0x4076f4 in std::thread::_Invoker<std::tuple<void (*)()> >::operator()() /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/thread:251:11
    #12 0x407598 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> > >::_M_run() /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/thread:195:13
    #13 0x7ffff62bf0df  (libstdc++.so.6+0xd00df)

previously allocated by thread T3 here:
    #0 0x7ffff7268858 in malloc (/opt/pytsandebug3.7/lib64/libclang_rt.asan-x86_64.so+0x125858)
    #1 0x7ffff6bf23b8 in _PyMem_DebugRawAlloc /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/obmalloc.c:2052:24
    #2 0x7ffff6bf23b8 in _PyMem_DebugRawMalloc /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/obmalloc.c:2081
    #3 0x7ffff6bf23b8 in _PyMem_DebugMalloc /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/obmalloc.c:2237
    #4 0x7ffff6bea516 in PyObject_Malloc /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/obmalloc.c:633:12
    #5 0x7ffff6bea516 in _PyObject_New /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/object.c:255
    #6 0x7fffe6cf56ca in context_new /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Modules/_decimal/_decimal.c:1177:16
    #7 0x7ffff6c49527 in type_call /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/typeobject.c:929:11
    #8 0x7ffff6b330ca in _PyObject_FastCallDict /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/call.c:125:18
    #9 0x7fffe6cf8b0c in context_copy /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Modules/_decimal/_decimal.c:1403:12
    #10 0x7fffe6cf8b0c in init_current_context /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Modules/_decimal/_decimal.c:1497
    #11 0x7fffe6cf8b0c in current_context /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Modules/_decimal/_decimal.c:1525
    #12 0x7fffe6cf8b0c in dec_new /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Modules/_decimal/_decimal.c:2652
    #13 0x7ffff6c49527 in type_call /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/typeobject.c:929:11
    #14 0x7ffff6b35454 in _PyObject_FastCallKeywords /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/call.c:199:18
    #15 0x7ffff6d7c85c in call_function /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/ceval.c:4619:17
    #16 0x7ffff6d677c1 in _PyEval_EvalFrameDefault /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/ceval.c:3093:23
    #17 0x7ffff6b34b99 in PyEval_EvalFrameEx /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/ceval.c:547:12
    #18 0x7ffff6b34b99 in function_code_fastcall /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/call.c:283
    #19 0x7ffff6b338d4 in _PyFunction_FastCallDict /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/call.c
    #20 0x7ffff6b37683 in _PyObject_Call_Prepend /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/call.c:904:14
    #21 0x7ffff6b3c8d9 in method_call /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/classobject.c:309:12
    #22 0x7ffff6b330ca in _PyObject_FastCallDict /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Objects/call.c:125:18
    #23 0x40510e in ThreadFunc() /home/local/TENSOR-CORP/boytsovea/python_crash/main.cpp:30:23
    #24 0x4077db in void std::__invoke_impl<void, void (*)()>(std::__invoke_other, void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/invoke.h:60:14
    #25 0x40774c in std::__invoke_result<void (*)()>::type std::__invoke<void (*)()>(void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/invoke.h:95:14
    #26 0x407724 in void std::thread::_Invoker<std::tuple<void (*)()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/thread:244:13
    #27 0x4076f4 in std::thread::_Invoker<std::tuple<void (*)()> >::operator()() /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/thread:251:11
    #28 0x407598 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> > >::_M_run() /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/thread:195:13
    #29 0x7ffff62bf0df  (libstdc++.so.6+0xd00df)

Thread T6 created by T0 here:
    #0 0x7ffff71a3f82 in pthread_create (/opt/pytsandebug3.7/lib64/libclang_rt.asan-x86_64.so+0x60f82)
    #1 0x7ffff62bf374 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (libstdc++.so.6+0xd0374)
    #2 0x406fa0 in void __gnu_cxx::new_allocator<std::thread>::construct<std::thread, void (*)()>(std::thread*, void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/ext/new_allocator.h:147:23
    #3 0x4067fc in void std::allocator_traits<std::allocator<std::thread> >::construct<std::thread, void (*)()>(std::allocator<std::thread>&, std::thread*, void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/alloc_traits.h:484:8
    #4 0x4058fd in void std::vector<std::thread, std::allocator<std::thread> >::emplace_back<void (*)()>(void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/vector.tcc:115:6
    #5 0x40543d in main /home/local/TENSOR-CORP/boytsovea/python_crash/main.cpp:46:16
    #6 0x7ffff592a3d4 in __libc_start_main /usr/src/debug/glibc-2.17-c758a686/csu/../csu/libc-start.c:266

Thread T3 created by T0 here:
    #0 0x7ffff71a3f82 in pthread_create (/opt/pytsandebug3.7/lib64/libclang_rt.asan-x86_64.so+0x60f82)
    #1 0x7ffff62bf374 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (libstdc++.so.6+0xd0374)
    #2 0x406fa0 in void __gnu_cxx::new_allocator<std::thread>::construct<std::thread, void (*)()>(std::thread*, void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/ext/new_allocator.h:147:23
    #3 0x4067fc in void std::allocator_traits<std::allocator<std::thread> >::construct<std::thread, void (*)()>(std::allocator<std::thread>&, std::thread*, void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/alloc_traits.h:484:8
    #4 0x406b05 in void std::vector<std::thread, std::allocator<std::thread> >::_M_realloc_insert<void (*)()>(__gnu_cxx::__normal_iterator<std::thread*, std::vector<std::thread, std::allocator<std::thread> > >, void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/vector.tcc:449:4
    #5 0x4059b1 in void std::vector<std::thread, std::allocator<std::thread> >::emplace_back<void (*)()>(void (*&&)()) /opt/gcc-9.1.1/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/vector.tcc:121:4
    #6 0x40543d in main /home/local/TENSOR-CORP/boytsovea/python_crash/main.cpp:46:16
    #7 0x7ffff592a3d4 in __libc_start_main /usr/src/debug/glibc-2.17-c758a686/csu/../csu/libc-start.c:266

SUMMARY: AddressSanitizer: heap-use-after-free /home/local/TENSOR-CORP/ga.vtorov/rpmbuild/BUILD/Python-3.7.3/Python/context.c:229:5 in PyContextVar_Get
Shadow bytes around the buggy address:
  0x0c1882b07fb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1882b07fc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1882b07fd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1882b07fe0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1882b07ff0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c1882b08000: fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c1882b08010: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c1882b08020: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
  0x0c1882b08030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1882b08040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1882b08050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==22361==ABORTING